import React, {Component} from 'react';
import {withRouter} from 'react-router-dom'
class Header extends Component {
    back=()=>{
        this.props.history.goBack()
    }
    forward=()=>{
        this.props.history.goForward()
    }
    go=()=>{
        this.props.history.go(-2)
    }
    pushHomeMe=()=>{
        this.props.history.push('/home/message')
    }
    render() {
        console.log('props',this.props)
        return (
            <div className="row">
                <div className="col-xs-offset-2 col-xs-8">
                    <div className="page-header"><h2>React Router Demo</h2></div>
                    <button onClick={this.back}>回退</button>
                    <button onClick={this.forward}>前进</button>
                    <button onClick={this.go}>go</button>
                    <button onClick={this.pushHomeMe}>home/message</button>
                </div>
            </div>
        );
    }
}

export default withRouter(Header);